package lu.med.praxiswahl.wahlumed.client.arztdatabase;

import lu.med.praxiswahl.wahlumed.client.utilities.Parser;

/**
 * 
 * @author Lars Holger Roth
 */
public class ArztTableDataset
{
    private String[] buffer = new String[20];
    private Long id = 0l;

    public ArztTableDataset()
    {
	preset();
    }

    public ArztTableDataset(String com)
    {
	preset();
	String[] tok = Parser.parseString(com);
	for (int i = 0; i < tok.length; i++)
	{
	    buffer[i] = tok[i];
	}
    }

    public String getBufferAt(int index)
    {
	return buffer[index];
    }

    public Long getID()
    {
	return id;
    }

    public void preset()
    {
	for (int i = 0; i < buffer.length; i++)
	    buffer[i] = "";
    }

    public void setBufferAt(String val, int index)
    {
	buffer[index] = val;
    }

    public void setID(Long val)
    {
	id = val;
    }

    @Override
    public String toString()
    {
	String str = "{";
	// Name vom Hausarzt
	str += buffer[0] + "#";
	// Vorname
	str += buffer[1] + "#";
	// Adresse
	str += buffer[2] + "#";
	// Fachgebiet
	str += buffer[3] + "#";
	// Tel
	str += buffer[4] + "#";
	// Fax
	str += buffer[5] + "#";
	// EMail
	str += buffer[6] + "#";
	// Hash / keyword
	str += buffer[19] + "}";
	return str;
    }
}
